import request from '@/config/axios'

// 设备实例 VO
export interface DeviceInstanceVO {
  id: number // 主键id
  deviceId: number // 设备id
  code: string // 设备编码
  procurementTime: Date // 采购时间
  ownerId: number // 所属人
  tag: string // 标签
  usageTime: Date // 投入时间
  unitId: number // 单元
  departmentId: number // 部门
}

// 设备实例 API
export const DeviceInstanceApi = {
  // 查询设备实例分页
  getDeviceInstancePage: async (params: any) => {
    return await request.get({ url: `/zjyj/device-instance/page`, params })
  },

  // 查询设备实例详情
  getDeviceInstance: async (id: number) => {
    return await request.get({ url: `/zjyj/device-instance/get?id=` + id })
  },

  // 新增设备实例
  createDeviceInstance: async (data: DeviceInstanceVO) => {
    return await request.post({ url: `/zjyj/device-instance/create`, data })
  },

  // 修改设备实例
  updateDeviceInstance: async (data: DeviceInstanceVO) => {
    return await request.put({ url: `/zjyj/device-instance/update`, data })
  },

  // 删除设备实例
  deleteDeviceInstance: async (id: number) => {
    return await request.delete({ url: `/zjyj/device-instance/delete?id=` + id })
  },

  // 导出设备实例 Excel
  exportDeviceInstance: async (params) => {
    return await request.download({ url: `/zjyj/device-instance/export-excel`, params })
  }
}
